{extend name="mainadmin@layouts/base" /}
{block name="head" }
<link rel="stylesheet" href="__STATIC__/js/jquery/jquery_ui/jquery-ui.css">
<script src="__STATIC__/js/jquery/jquery_ui/jquery-ui.js"></script>
{/block}
{block name="main" }
<header class="header  b-b clearfix">
    <div class="page-breadcrumbs">
        <ul class="breadcrumb" >
            <li>
                <i class="fa fa-ellipsis-v"></i>
                <strong>层级政策</strong>
            </li>
        </ul>
    </div>
</header>
<form class="form-horizontal form-validate form_vbox" id="_form" method="post" action="{:url('setting')}">
    <section class="vbox">
        <section class="scrollable  wrapper w-f">
            <section class="panel panel-default">
                <header>
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#purchase" data-toggle="tab">进货设置</a></li>
                        <li><a href="#invite" data-toggle="tab">邀请设置</a></li>
                        <li><a href="#check" data-toggle="tab">审核机制</a></li>
                        <li><a href="#join" data-toggle="tab">加入门槛</a></li>
                        <li class="hide"><a href="#recharge" data-toggle="tab">充值要求</a></li>
                        <li class="hide"><a href="#order" data-toggle="tab">订单要求</a></li>
                        <li><a href="#upgrade" data-toggle="tab">升级政策</a></li>
                        <li><a href="#uplevel_goods_money" data-toggle="tab">升级货款设置</a></li>
                    </ul>
                </header>
                <div class="tab-content">
                    <div class="tab-pane active" id="purchase">
                        <div class="form-group">
                            <label class=" control-label">进货设置：</label>
                            <div class="col-sm-10">
                                <div class="help-inline" style="line-height: 20px;">
                                    <b style="color:#555;"> 控制每个层级的进货方式</b>
                                    <br>选择云仓那么代理将货物暂存到云仓库内，按需提货，现货代理必须直接下单发货，混合模式两种都可以，特别注意定义云仓时，上一个层级也必须开启云仓</div>
                                {volist name="proxy_list" id="vo"}
                                <div class="col-sm-10 m-t-mc">
                                    <label class="control-label">{$vo.proxy_name}：</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="purchase_setting[{$vo.proxy_id}]" value="1" {$vo.purchase_setting|tplckval='=1','checked'}/>云仓</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="purchase_setting[{$vo.proxy_id}]" value="2" {$vo.purchase_setting|tplckval='=2','checked',true}/>现货</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="purchase_setting[{$vo.proxy_id}]" value="3" {$vo.purchase_setting|tplckval='=3','checked'}/>复合（云仓+现货）</label>
                                 </div>
                                {/volist}
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="invite">
                        <div class="form-group">
                            <label class=" control-label">邀请设置：</label>
                            <div class="col-sm-10">
                                <div class="help-inline">
                                    <b style="color:#555;"> 设置代理可邀请的级别</b>
                                </div>
                                {volist name="proxy_list" id="vo"}
                                <div class="col-sm-10 m-t-mc">
                                    <label class="control-label">{$vo.proxy_name}：</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="invite_setting[{$vo.proxy_id}]" value="1" {$vo.invite_setting|tplckval='=1','checked'}/>任意级别</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="invite_setting[{$vo.proxy_id}]" value="2" {$vo.invite_setting|tplckval='=2','checked'}/>同级和下级</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="invite_setting[{$vo.proxy_id}]" value="3" {$vo.invite_setting|tplckval='=3','checked',true}/>仅下级</label>
                                </div>
                                {/volist}
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="check">
                        <div class="form-group">
                            <label class=" control-label">自动审核：</label>
                            <div class="col-sm-10">
                                <div class="help-inline">
                                    <b style="color:#555;"> 启用：代理满足条件后自动成为代理或升级，不启用：满足条件后平台审核后才能完成加入或升级</b>
                                </div>
                                {volist name="proxy_list" id="vo"}
                                <div class="col-sm-10 m-t-mc">
                                    <label class="control-label">{$vo.proxy_name}：</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="is_auto_check[{$vo.proxy_id}]" value="1" {$vo.is_auto_check|tplckval='=1','checked'}/>启用</label>
                                    <label class="radio-inline">
                                        <input type="radio" name="is_auto_check[{$vo.proxy_id}]" value="0" {$vo.is_auto_check|tplckval='=0','checked',true}/>不启用</label>
                                </div>
                                {/volist}
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="join">
                        <div class="form-group">
                            <label class=" control-label">门槛条件：</label>
                            <div class="col-sm-9 ">
                                {volist name="proxy_list" id="vo"}
                                <div class="col-sm-10 m-t-md">
                                    <b style="color: #555;">{$vo.proxy_name}</b>
                                    <div class="line line-dashed"></div>
                                    <div class="input-group ">
                                        <label class="radio-inline">是否可被邀请：</label>
                                        <label class="radio-inline">
                                            <input type="radio" name="is_invite[{$vo.proxy_id}]" value="1" {$vo.is_invite|tplckval='=1','checked'} class="js_radio_undertake"
                                            data-class="is_invite_box_{$vo.proxy_id}"/>是</label>
                                        <label class="radio-inline">
                                            <input type="radio" name="is_invite[{$vo.proxy_id}]" value="0"  {$vo.is_invite|tplckval='=0','checked',true} class="js_radio_undertake"
                                            />否</label>
                                    </div>
                                    <div class="radio_undertake_is_invite_{$vo.proxy_id} is_invite_box_{$vo.proxy_id} {$vo['is_invite']==0?'hide':''}">
                                        <div class="input-group ">
                                             <label class="radio-inline">是否限制门槛：</label>
                                            <label class="radio-inline">
                                                <input type="radio" name="is_join_limit[{$vo.proxy_id}]" value="1" {$vo.is_join_limit|tplckval='=1','checked'} class="js_radio_undertake"
                                                data-class="is_join_limit_box_{$vo.proxy_id}"/>开启门槛</label>
                                            <label class="radio-inline">
                                                <input type="radio" name="is_join_limit[{$vo.proxy_id}]" value="0"  {$vo.is_join_limit|tplckval='=0','checked',true} class="js_radio_undertake"
                                                />无门槛-任意加入</label>
                                        </div>
                                        <div class="col-sm-offset-2 radio_undertake_is_join_limit_{$vo.proxy_id} is_join_limit_box_{$vo.proxy_id} {$vo['is_join_limit']==0?'hide':''}">
                                            <div class="input-group form-group-addon">
                                                <label><input type="checkbox" class="check_input_disabled" name="join_uplevel_goods_money_limit[{$vo.proxy_id}]" {$vo['join_uplevel_goods_money_limit']==1?'checked':''} value="1" >完成充值【升级货款】金额</label>
                                            </div>
                                            <div class="input-group form-group-addon hide">
                                                <label><input type="checkbox" class="check_input_disabled" name="join_earnest_money_limit[{$vo.proxy_id}]" {$vo['join_earnest_money_limit']==1?'checked':''} value="1">充值保证金要求</label><input type="text" class="input-mmini" name="join_earnest_money[{$vo.proxy_id}]" data-rule-min="1" data-rule-number="true" data-rule-required="true" {$vo['join_earnest_money_limit']==1?'':'disabled'}  value="{$vo['join_earnest_money']}" > <span class="input-group-addon">元</span>
                                            </div>
                                            <div class="input-group form-group-addon">
                                                <label><input type="checkbox" class="check_input_disabled" name="join_goods_money_limit[{$vo.proxy_id}]" {$vo['join_goods_money_limit']==1?'checked':''} value="1" >充值货款要求</label><input type="text" class="input-mmini" name="join_goods_money[{$vo.proxy_id}]" data-rule-min="1" data-rule-number="true" data-rule-required="true" {$vo['join_goods_money_limit']==1?'':'disabled'} value="{$vo['join_goods_money']}" > <span class="input-group-addon">元</span>
                                            </div>
                                            <div class="input-group hide">
                                                <label><input type="checkbox" name="order_first_spot_limit[{$vo.proxy_id}]" {$vo['order_first_spot_limit']==1?'checked':''} class="check_input_disabled" value="1">完成首购现货订单</label>
                                            </div>
                                            <div class="input-group hide">
                                                <label><input type="checkbox" name="order_first_cloud_limit[{$vo.proxy_id}]" {$vo['order_first_cloud_limit']==1?'checked':''} class="check_input_disabled" value="1">完成首购云仓订单</label>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                {/volist}
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="upgrade">
                        <div class="form-group">
                            <label class=" control-label">升级条件：</label>
                            <div class="col-sm-10">
                                {volist name="proxy_list" id="vo"}
                                <div class="col-sm-10 m-t-md">
                                    <b style="color: #555;">{$vo.proxy_name}</b>
                                    <div class="line line-dashed"></div>
                                        <div class="input-group">
                                            <label class="radio-inline">升级方式：</label>
                                            <label class="radio-inline">
                                                <input type="radio" name="upgrade_type[{$vo.proxy_id}]" value="1" {$vo.upgrade_type|tplckval='=1','checked'} class="js_radio_undertake"
                                                data-class="upgrade_setting_{$vo.proxy_id}" />条件升级</label>
                                            <label class="radio-inline">
                                                <input type="radio" name="upgrade_type[{$vo.proxy_id}]" value="0" {$vo.upgrade_type|tplckval='=0','checked',true} class="js_radio_undertake"/>手动调整</label>
                                        </div>
                                    <div class="radio_undertake_upgrade_type_{$vo.proxy_id} upgrade_setting_{$vo.proxy_id} {$vo['upgrade_type']==0?'hide':''}">
                                        <div class="input-group ">
                                            指定层级：
                                            <select  multiple="multiple" name="upgrade_limit_proxy[{$vo.proxy_id}][]" data-toggle="select2" style="min-width: 500px;">
                                                {volist name="proxy_list" id="vob"}
                                                {if condition="$vob['level']>$vo['level']"}
                                                <option value="{$vob.proxy_id}" {:in_array($vob['proxy_id'],$vo['upgrade_limit_proxy_arr'])?'selected':''}>{$vob.proxy_name}</option>
                                                {/if}
                                                {/volist}
                                            </select><span class="tooltip-darkorange fa fa-question-circle" data-toggle="tooltip"   data-placement="bottom" data-html="true" data-original-title="选择可以申请该层级的下级层级，不设置为不限制"></span>
                                        </div>
                                        <div class="input-group m-t-mc">
                                            同时满足：<label>
                                            <input class="checkbox-slider colored-orange" name="upgrade_all_limit[{$vo.proxy_id}]" {$vo['upgrade_all_limit']==1?'checked':''} type="checkbox" value="1" >
                                            <span class="text"></span>
                                        </label><span class="tooltip-darkorange fa fa-question-circle" data-toggle="tooltip"  data-placement="bottom" data-html="true" data-original-title="开启后需要同时满足以下条件"></span>
                                        </div>
                                        <div class="input-group form-group-addon">
                                            <label><input type="checkbox" name="upgrade_uplevel_goods_money_limit[{$vo.proxy_id}]" {$vo['upgrade_uplevel_goods_money_limit']==1?'checked':''} class="check_input_disabled" value="1">完成充值【升级货款】金额</label>
                                        </div>
                                        <div class="input-group form-group-addon hide">
                                            <label><input type="checkbox" name="upgrade_earnest_money_limit[{$vo.proxy_id}]" {$vo['upgrade_earnest_money_limit']==1?'checked':''} class="check_input_disabled" value="1">充值保证金要求，累计</label><input type="text" class="input-mmini" name="upgrade_earnest_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true" data-rule-required="true" {$vo['upgrade_earnest_money_limit']==1?'':'disabled'} value="{$vo['upgrade_earnest_money']}"> <span class="input-group-addon">元</span>
                                        </div>
                                        <div class="input-group form-group-addon">
                                            <label><input type="checkbox" name="upgrade_team_limit[{$vo.proxy_id}]" {$vo['upgrade_team_limit']==1?'checked':''}  class="check_input_disabled"  value="1">团队构成要求值</label>直推：<input type="text" class="input-smini" name="upgrade_direct_push_num[{$vo.proxy_id}]" {$vo['upgrade_team_limit']==1?'':'disabled'} data-rule-min="0" data-rule-number="true" value="{$vo.upgrade_direct_push_num}" > <span class="input-group-addon">人</span>，
                                            <select  data-toggle="select2" data-notsearch="true" name="upgrade_team_proxy_id[{$vo.proxy_id}]"  style="width: 150px; margin-right: 5px;">
                                                <option value="0" >不限制</option>
                                                {volist name="proxy_list" id="voc"}
                                                {if condition="$voc['level']>=$vo['level']"}
                                                <option value="{$voc.proxy_id}" {$voc['proxy_id']==$vo['upgrade_team_proxy_id']?'selected':''}>{$voc.proxy_name}</option>
                                                {/if}
                                                {/volist}
                                            </select><input type="text" class="input-smini" name="upgrade_team_proxy_num[{$vo.proxy_id}]" {$vo['upgrade_team_limit']==1?'':'disabled'} data-rule-min="0" data-rule-number="true" value="{$vo.upgrade_team_proxy_num}" > <span class="input-group-addon">人</span>
                                            ，团队总数：<input type="text" class="input-smini" name="upgrade_team_all_num[{$vo.proxy_id}]" {$vo['upgrade_team_limit']==1?'':'disabled'} data-rule-min="0" data-rule-number="true" value="{$vo.upgrade_team_all_num}" > <span class="input-group-addon">人</span>
                                        </div>
                                    </div>
                                </div>
                                {/volist}
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="order">
                        <div class="form-group">
                            <label class=" control-label">订单要求：</label>
                            <div class="col-sm-10">
                                {volist name="proxy_list" id="vo"}
                                <div class="col-sm-10 m-t-md">
                                    <b style="color: #555;">{$vo.proxy_name}</b>
                                    <div class="line line-dashed"></div>

                                    <div class="input-group form-group-addon">
                                        <label>首笔现货订单要求</label><input type="text" class="input-mmini" name="order_first_spot_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true"   value="{$vo.order_first_spot_money}" >
                                        <span class="input-group-addon">元</span>
                                    </div>

                                    <div class="input-group form-group-addon">
                                        <label>首笔云仓订单要求</label><input type="text" class="input-mmini" name="order_first_cloud_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true"   value="{$vo.order_first_cloud_money}"  >
                                        <span class="input-group-addon">元</span>
                                    </div>
                                    <div class="input-group form-group-addon">
                                        <label>首笔云仓提货要求</label><input type="text" class="input-mmini" name="order_first_cloud_pickup_money[{$vo.proxy_id}]" data-rule-min="0"data-rule-number="true" value="{$vo.order_first_cloud_pickup_money}"  >
                                        <span class="input-group-addon">元</span>
                                    </div>
                                    <div class="input-group form-group-addon">
                                        <label>二次现货补货要求</label><input type="text" class="input-mmini" name="order_patch_spot_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true" value="{$vo.order_patch_spot_money}"  >
                                        <span class="input-group-addon">元</span>
                                    </div>
                                    <div class="input-group form-group-addon">
                                        <label>二次云仓补货要求</label><input type="text" class="input-mmini" name="order_patch_cloud_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true" value="{$vo.order_patch_cloud_money}"  >
                                        <span class="input-group-addon">元</span>
                                    </div>
                                    <div class="input-group form-group-addon">
                                        <label>二次云仓提货要求</label><input type="text" class="input-mmini" name="order_twice_cloud_pickup_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true" value="{$vo.order_twice_cloud_pickup_money}"  >
                                        <span class="input-group-addon">元</span>
                                    </div>
                                </div>
                                {/volist}
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="recharge">
                        <div class="form-group">
                            <label class=" control-label">充值要求：</label>
                            <div class="col-sm-9">
                                {volist name="proxy_list" id="vo"}
                                <div class="col-sm-10 m-t-md">
                                    <b style="color: #555;">{$vo.proxy_name}</b>
                                    <div class="line line-dashed"></div>
                                    <div class="input-group form-group-addon">
                                        <label>首次货款充值不得少于</label><input type="text" class="input-mmini" name="recharge_first_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true" value="{$vo.recharge_first_money}" > <span class="input-group-addon">元</span>
                                    </div>
                                    <div class="input-group form-group-addon">
                                        <label>每次货款充值不得少于</label><input type="text" class="input-mmini" name="recharge_each_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true" value="{$vo.recharge_each_money}" > <span class="input-group-addon">元</span>
                                    </div>
                                </div>
                                {/volist}
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="uplevel_goods_money">
                        <div class="form-group">
                            <label class=" control-label">充值设置：</label>
                            <div class="col-sm-9">
                                {volist name="proxy_list" id="vo"}
                                <div class="col-sm-10 m-t-md">
                                    <b style="color: #555;">{$vo.proxy_name}</b>
                                    <div class="line line-dashed"></div>
                                    <div class="col-sm-9">
                                        <div class="fl input-group form-group-addon">
                                            充值<input type="text" class="input-mmini" name="uplevel_goods_money[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true" data-rule-required="true" value="{$vo['uplevel_goods_money']|default=0}" > <span class="input-group-addon">元</span>
                                        </div>
                                        <div class="fl input-group form-group-addon">
                                            ，升级货款实到帐<input type="text" class="input-mmini" name="uplevel_goods_money_arrive[{$vo.proxy_id}]" data-rule-min="0" data-rule-number="true" data-rule-required="true" value="{$vo['uplevel_goods_money_arrive']|default=0}" > <span class="input-group-addon">元</span>
                                        </div>
                                    </div>
                                </div>
                                {/volist}
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </section>
        <footer class="footer bg-white b-t p-t">
            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-1">
                    <button type="submit" class="btn btn-primary js_save_submit" data-loading-text="保存中...">保存
                    </button>
                    <button type="button" class="btn btn-default" data-toggle="back">取消</button>
                </div>
            </div>
        </footer>
    </section>
</form>
{/block}
{block name="footer" }
{/block}